package ncut.shumei.dao;

import ncut.shumei.entity.TaskComment;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface TaskCommentDao {
    
    @Select("SELECT c.*, u.username FROM task_comments c " +
            "LEFT JOIN users u ON c.user_id = u.id " +
            "WHERE c.task_id = #{taskId} ORDER BY c.create_time DESC")
    List<TaskComment> findByTaskId(Integer taskId);
    
    @Insert("INSERT INTO task_comments (task_id, user_id, content, create_time) " +
            "VALUES (#{taskId}, #{userId}, #{content}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(TaskComment comment);
} 